package com.igeek.car.exception;

import com.igeek.car.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * TODO
 *
 * @author bbjs
 * @since 2024/12/4
 */
@RestControllerAdvice
public class CustomHandlerException {

    @ExceptionHandler
    public Result exception(CarException ex) {
        return new Result(false, ex.getMessage());
    }

    @ExceptionHandler
    public Result exHandler2(Exception ex){
        ex.printStackTrace();
        return new Result(false , "内部错误");
    }

}
